package com.sikaryofficial.system.api.factory;

import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.system.api.RemoteReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 日志服务降级处理
 *
 * @author qinjinyuan
 */
@Component
public class RemoteReportFallbackFactory implements FallbackFactory<RemoteReportService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteReportFallbackFactory.class);

    @Override
    public RemoteReportService create(Throwable throwable) {
        log.error("自动处理举报服务调用失败:{}", throwable.getMessage());
        return new RemoteReportService() {
            /**
             * 自动处理30分以上为 受理中的举报
             *
             * @return 结果
             */
            @Override
            public R<Boolean> autoProcess() {
                return R.fail("自动处理举报失败:" + throwable.getMessage());
            }

        };

    }
}
